require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rcov/rcovtask'

desc 'Default: run unit tests.'
task :default => :test

desc 'Test the who_charted plugin.'
Rake::TestTask.new(:test) do |t|
  t.libs << 'lib'
  t.libs << 'lib/chart_types'
  t.libs << 'lib/chart_features'
  t.libs << 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = true
end

namespace :test do
  Rcov::RcovTask.new(:coverage) do |t|
  t.libs << 'lib'
  t.libs << 'lib/chart_types'
  t.libs << 'lib/chart_features'
  t.libs << 'test'
  t.test_files = FileList['test/**/*_test.rb']
  t.output_dir = 'test/coverage'
  t.verbose = true
  t.rcov_opts << ['-Ilib',
                  '--text-summary',
                  '--sort coverage',
                  '--exclude /gems/,dependency_list.rb,/usr/local/lib']
  end
end

desc 'Generate documentation for the acts_crummy plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title    = 'who_charted'
  rdoc.options << '--line-numbers' << '--inline-source'
  rdoc.rdoc_files.include('README', 'RELEASE_NOTES')
  rdoc.rdoc_files.include('lib/**/*.rb')
end
